random_seed: 1244
exp_name: &exp_name default
float_precision: "medium"
log_level: info

save_ckpt: True
save_logs: True
use_pretrained: False
pretrained_dir: "pretrained"
pretrained_model: "" # if empty, will use the latest checkpoint

test_triton:
  test_num: 10
  tolerance: 1e-5

triton:
  model_name: "tire_quality_classifier"
  server_url: "localhost:8500"
  models_path: "triton/model_repository/tire_quality_classifier/1"

code_version:
  version: 0.1.0
  git_commit_id: "" # will be filled during run

export:
  export_path: "./outputs/export"
  export_name: "model"
  name_version: True
  input_sample_shape: [1, 3, 150, 150]
  export_triton: False

data_module:
  _target_: tirechecktool.dataset.TireCheckDataModule
  batch_size: 32
  data_dir: data
  git_url: "https://github.com/VitalyyBezuglyj/tire-check-tool.git"
  img_size: 150
  img_mean: [0.485, 0.456, 0.406]
  img_std: [0.229, 0.224, 0.225]
  random_rotation: 10
  teardown: False

tire_check_model:
  _target_: tirechecktool.model.TireCheckModel
  _recursive_: False
  n_classes: 2
  learning_rate: 1e-3
  optimizer:
    _target_: torch.optim.AdamW
    lr: 1e-3
  scheduler:
    _target_: torch.optim.lr_scheduler.ReduceLROnPlateau
    mode: max
    factor: 0.1
    patience: 2
    verbose: True
    threshold: 0.0001
    threshold_mode: rel
    cooldown: 0
    min_lr: 0
    eps: 1e-08

callbacks:
  lr_monitor:
    _target_: pytorch_lightning.callbacks.LearningRateMonitor
    logging_interval: step
  model_summary:
    _target_: pytorch_lightning.callbacks.RichModelSummary
    max_depth: 1
  device_stats:
    _target_: pytorch_lightning.callbacks.DeviceStatsMonitor
  model_ckpt:
    _target_: pytorch_lightning.callbacks.ModelCheckpoint
    save_top_k: 1
    monitor: val_MulticlassF1Score
    mode: max
    filename: "best_{epoch:02d}-{val_MulticlassF1Score:.4f}"
    every_n_epochs: 1
    save_last: True
    save_weights_only: False
    dirpath: outputs/checkpoints

loggers:
  log_to: ["csv", "mlflow"] # possible values: ['csv', 'mlflow']
  mlflow:
    _target_: pytorch_lightning.loggers.MLFlowLogger
    log_model: True
    save_dir: ./outputs/mlfolw_logs
    experiment_name: *exp_name
    tags: { exp_name: *exp_name }
    tracking_uri: http://localhost:5000
    artifact_location: ./outputs/mlflow_artifacts
  csv:
    _target_: pytorch_lightning.loggers.CSVLogger
    save_dir: outputs/csv_logs

trainer:
  _target_: pytorch_lightning.Trainer
  precision: 16-mixed
  accelerator: gpu
  max_epochs: 5
  gradient_clip_val: 1.0
  log_every_n_steps: 25
  deterministic: False
  benchmark: False
  num_sanity_val_steps: 4
  overfit_batches: 0
  val_check_interval: 1.0

inferer:
  _target_: pytorch_lightning.Trainer
  accelerator: gpu
